cmake_minimum_required(VERSION 3.5)

add_library(vehicle_linear_ll vehicle_linear_ll.cpp)
target_link_libraries(vehicle_linear_ll LinearSys yaml-cpp)

add_library(vehicle_linear_4d4s vehicle_linear_4d4s.cpp)
target_link_libraries(vehicle_linear_4d4s LinearSys yaml-cpp OsqpSolver)

add_library(vehicle_lateral_speed vehicle_lateral_speed.cpp)
target_link_libraries(vehicle_lateral_speed LinearSys yaml-cpp)

add_library(vehicle_lateral_speed3dis vehicle_lateral_speed3dis.cpp)
target_link_libraries(vehicle_lateral_speed3dis LinearSys yaml-cpp)

add_library(vehicle_lateral_speed_yaw vehicle_lateral_speed_yaw.cpp)
target_link_libraries(vehicle_lateral_speed_yaw LinearSys yaml-cpp)

add_library(vehicle_vy_yaw_error3dis vehicle_vy_yaw_error3dis.cpp)
target_link_libraries(vehicle_vy_yaw_error3dis LinearSys yaml-cpp)

add_library(vehicle_lateral_tire vehicle_lateral_tire.cpp)
target_link_libraries(vehicle_lateral_tire LinearSys yaml-cpp tire_model)

add_library(VehicleDyn INTERFACE)
target_link_libraries(VehicleDyn INTERFACE
					vehicle_linear_ll
					vehicle_lateral_speed
					vehicle_lateral_speed3dis
					vehicle_lateral_speed_yaw
					vehicle_vy_yaw_error3dis
					vehicle_linear_4d4s
					vehicle_lateral_tire
		)
set(test_vehicle_dyn_path "${CMAKE_CURRENT_SOURCE_DIR}/test/test_yaml/")  
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/test_vehicle_dyn_path.h.in 
${CMAKE_CURRENT_SOURCE_DIR}/test/test_vehicle_dyn_path.h)

add_executable(test_vehicle_dyn test/test_vehicle_dyn.cpp)
target_link_libraries(test_vehicle_dyn VehicleDyn ${catkin_LIBRARIES}) 
target_include_directories(test_vehicle_dyn PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test)


add_executable(test_vy_yaw_error3dis test/test_vy_yaw_error3dis.cpp)
target_link_libraries(test_vy_yaw_error3dis VehicleDyn ${catkin_LIBRARIES}) 
target_include_directories(test_vy_yaw_error3dis PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test)